import { createRouter, createWebHashHistory,createWebHistory } from 'vue-router'
// create 有创建的意思 Web 代表的是浏览器端 History 指的是历史
import HomeView from '../views/HomeView.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path: '/second',
    name: 'Second',
    component: () => import(/* webpackChunkName: "about" */ '../views/second.vue')
  },
  {
    path: '/watch',
    name: 'Watch',
    component: () => import(/* webpackChunkName: "about" */ '../views/watch.vue')
  },
  {
    path: '/drict',
    name: 'Drict',
    component: () => import(/* webpackChunkName: "about" */ '../views/drict.vue')
  },
  {
    path: '/slot',
    name: 'Slot',
    component: () => import(/* webpackChunkName: "about" */ '../views/slot.vue')
  }
]
// createWebHashHistory 路由的hash模式
const router = createRouter({
  history: createWebHashHistory(), // 路由的模式 
  routes
})
// before 在什么什么之前
// router.beforeEach((to,from) => { // 路由拦截 // 在 vue-router 4.0 之后取消 next(可写可不写)
//     // to 到那里去  from 来自哪里
//     console.log(to);
//     console.log(from);
//     return true;
// })
export default router
